#!/usr/bin/env python3.10
# -*- encoding: utf-8 -*-
"""
@File    :   controllers.py
@Time    :   2024/02/19 17:07:33
@Author  :   windstarry 
@Version :   1.0
"""
# here put the import lib

from ninja_extra import (
    ModelConfig,
    ModelControllerBase,
    ModelSchemaConfig,
    ModelPagination,
    api_controller,
    route
)
from ninja_jwt.authentication import JWTAuth
from ninja_extra.permissions import IsAuthenticated
from ninja_extra.schemas import NinjaPaginationResponseSchema
from ninja_extra.pagination import (
    PageNumberPaginationExtra,
    PaginatedResponseSchema,
    paginate,
)
from .models import ExamCategory
from .service import ExamCategoryService

@api_controller("/exam", tags=["考试管理"])
class ExamController:
    @route.get(
        "",
        summary="考试信息",
        url_name="exam-info",
    )
    def get_exam_info(
        self,
    ):
        return {"message": "这里是考试信息"}
    
    
    # @route.get("/category", summary="考试分类", url_name="exam-category")
    # def get_exam_categorty_list(self,):
    #     return  {"message": "这里是考试分类列表"}
    
    
    # @route.post("/category",summary="新增考试分类",url_name="add-exam-category")
    # def add_exam_category(self,):
    #     return {"message": "这里是新增考试分类"}
    
    
    # @route.get("/category/{c_id}",summary="获取考试分类",url_name="get-exam-category")
    # def get_exam_category_by_id(self,c_id:int):
    #     return {"message": "这里是通过id获取考试分类"}
    
    # @route.post("/category/{c_id}",summary="修改考试分类",url_name="update-exam-category")
    # def update_exam_category(self,c_id:int):
    #     return {"message": "这里是修改考试分类"}
    
    # @route.delete("/category/{c_id}",summary="删除考试分类",url_name="delete-exam-category")
    # def delete_exam_category(self,c_id:int):
    #     return {"message": "这里是删除考试分类"}
    
    
@api_controller("/exam/category", tags=["考试分类管理"],permissions=[IsAuthenticated], auth=JWTAuth())
class ExamCategoryController(ModelControllerBase):
        service = ExamCategoryService(model=ExamCategory)
        model_config = ModelConfig(
        model=ExamCategory,
        schema_config=ModelSchemaConfig(include=["id","name","tag","description"],
                                        read_only_fields=["id",]),
        pagination=ModelPagination(),
    )